import Mock from 'mockjs';
const data = Mock.mock({
  code: 0, //0代表成功
  'data|10': [
    {
      'id|+1': 1,
      'registrationNo|1': '@cword(10)' + '@string("number",3,4)' + '号', //登记证明号
      'location|1': '@province' + '@city' + '@county', //坐落
      'titleMembers|2': [
        {
          //权利人
          'memberName|1': '@cname',
          'memberId|1':
            /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
        },
      ],
    },
  ],
});
// const data = [{ id: 1, name: 'zhangsan' }];

export default {
  // 支持值为 Object 和 Array
  'GET /api/users': data,

  '/api/todolist': {
    status: 0,
    list: [
      'Racing car sprays burning fuel into crowd.',
      'Japanese princess to wed commoner.',
      'Australian walks 100km after outback crash.',
      'Man charged over missing wedding girl.',
      'Los Angeles battles huge wildfires.',
    ],
  },

  // GET 可忽略
  '/api/users/1': { id: 1 },

  // 支持自定义函数，API 参考 express@4
  'POST /api/users/create': (req: any, res: any) => {
    // 添加跨域请求头
    res.setHeader('Access-Control-Allow-Origin', '*');
    res.end('ok');
  },
};
